import serve from '@/api/request'
const api = {
  // 登录
  login(data) {
    return serve({
      url: '/login',
      data,
      method: 'POST'
    })
  },
  // 获取Menu
  getMenuList() {
    return serve({
      url: '/menus',
      method: 'GET'
    })
  },
  // 獲取用戶列表
  getUserList(params) {
    return serve({
      method: 'GET',
      url: '/users',
      params
    })
  },
  //添加用户
  add_user(data) {
    return serve({
      method: "POST",
      url: '/users',
      data
    })
  },
  //修改用户状态
  editUserState(uId, type) {
    return serve({
      method: 'PUT',
      url: `users/${uId}/state/${type}`
    })
  },
  //根据用户id查询用户
  query_user_for_id(id) {
    return serve({
      method: "GET",
      url: `users/${id}`
    })
  },
  //编辑用户
  edit_user(id) {
    return serve({
      method: 'PUT',
      url: `users/${id}`,

    })
  },
  //删除用户
  delete_user(id) {
    return serve({
      method: 'delete',
      url: `users/${id}`,

    })
  }
}

export default api
